<!DOCTYPE html>
<html>
  <head>
    <title>Home</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />
    <script type="application/x-javascript">
      addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); }
    </script>
    <!-- Bootstrap Core CSS -->
    <link href="/themes/1/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <!-- Custom CSS -->
    <link href="/themes/1/css/style.css" rel="stylesheet" type="text/css" />
    <!-- font CSS -->
    <!-- font-awesome icons -->
    <link href="/themes/1/css/font-awesome.css" rel="stylesheet" />
    <!-- //font-awesome icons -->
    <!-- js-->
    <script src="/themes/1/js/jquery-1.11.1.min.js"></script>
    <script src="/themes/1/js/modernizr.custom.js"></script>
    <!--webfonts-->
    <link
      href="https://fonts.googleapis.com/css?family=Roboto+Condensed:400,300,300italic,400italic,700,700italic"
      rel="stylesheet"
      type="text/css"
    />
    <!--//webfonts-->
    <!--animate-->
    <link
      href="/themes/1/css/animate.css"
      rel="stylesheet"
      type="text/css"
      media="all"
    />
    <link
      href="https://cdn.bootcss.com/zTree.v3/3.5.40/css/zTreeStyle/zTreeStyle.css"
      rel="stylesheet"
      media="screen"
    />
    <script src="/themes/1/js/wow.min.js"></script>
    <script>
      new WOW().init();
    </script>
    <!--//end-animate-->
    <!-- chart -->
    <script src="/themes/1/js/Chart.js"></script>
    <!-- //chart -->
    <!--Calender-->
    <link rel="stylesheet" href="/themes/1/css/clndr.css" type="text/css" />
    <script
      src="/themes/1/js/underscore-min.js"
      type="text/javascript"
    ></script>
    <script src="/themes/1/js/moment-2.2.1.js" type="text/javascript"></script>
    <script src="/themes/1/js/clndr.js" type="text/javascript"></script>
    <script src="/themes/1/js/site.js" type="text/javascript"></script>
    <!--End Calender-->
    <!-- Metis Menu -->
    <script src="/themes/1/js/metisMenu.min.js"></script>
    <script src="/themes/1/js/custom.js"></script>

    <link href="/themes/1/css/custom.css" rel="stylesheet" />

    <!-- 引入jQuery 和 jQuery UI -->
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
    <link
      rel="stylesheet"
      href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css"
    />

    <script src="/treeview/index.css"></script>
    <script src="/themes/1/js/jquery.nicescroll.js"></script>
    <script src="/themes/1/js/scripts.js"></script>
    <!--//scrolling js-->
    <!-- Bootstrap Core JavaScript -->
    <script src="/themes/1/js/bootstrap.js"></script>
  </head>
  <body class="cbp-spmenu-push">
    <div class="tables">
      <div class="bs-example widget-shadow" data-example-id="contextual-table">
        <button
          type="button"
          class="btn btn-primary"
          data-toggle="modal"
          data-target="#exampleModal"
          data-whatever="@mdo"
          style="margin-bottom: 12px"
        >
          添加资源
        </button>
        <h4>资源列表</h4>

        <div>
          <%- include('./../components/resource.ejs', {tree: data.authTree, removeURL: "/admin/auth/resource/destory" }) %>
        </div>
      </div>
    </div>

    <div class="col-md-4 modal-grids">
      <div
        class="modal fade"
        id="exampleModal"
        tabindex="-1"
        role="dialog"
        aria-labelledby="exampleModalLabel"
      >
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <button
                type="button"
                class="close"
                data-dismiss="modal"
                aria-label="Close"
              >
                <span aria-hidden="true">&times;</span>
              </button>
              <h4 class="modal-title" id="exampleModalLabel">添加资源类别</h4>
            </div>
            <div class="modal-body">
              <form action="/admin/auth/resource/create" method="post">
                <div class="form-group">
                  <label for="recipient-name" class="control-label"
                    >分类名称:</label
                  >
                  <input
                    type="text"
                    class="form-control"
                    id="recipient-name"
                    name="name"
                  />
                </div>
                <div class="form-group">
                  <label for="recipient-name" class="control-label"
                    >路由地址:</label
                  >
                  <input
                    type="text"
                    class="form-control"
                    id="recipient-name"
                    name="path"
                  />
                </div>
                <div class="modal-footer">
                  <button
                    type="button"
                    class="btn btn-default"
                    data-dismiss="modal"
                  >
                    关闭
                  </button>
                  <button class="btn btn-primary" type="submit">保存</button>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- <div id="selectedModal" class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button
            type="button"
            class="close"
            data-dismiss="modal"
            aria-label="Close"
          >
            <span aria-hidden="true">&times;</span>
          </button>
          <h4 class="modal-title" id="exampleModalLabel">操作分类</h4>
        </div>
        <div class="modal-body">
       

        </div>

        <div class="modal-footer">
          <button
            type="button"
            class="btn btn-default"
            data-dismiss="modal"
          >
            关闭
          </button>
          <button class="btn btn-primary" type="submit">保存</button>
        </div>
      </div>
    </div> -->
    <!-- <script src="/treeview/index.js"></script> -->
    <!-- <script>
      $(document).ready(function () {
        $.get("/content/categories/tree").then(function(res) {
            let html = "<ul>";
            const formatter = function(list) {
                list.forEach(function(item) {
                   item.text = item.name;
                   if (item.children) {
                       item.nodes = item.children;
                       formatter(item.nodes);
                   }
                })
            }
            const result = res.data || [];
            formatter(result);
            console.log(result)
            $("#zTree").treeview({
              data: result,
              onNodeSelected: function (event, data) {  
                // $('#selectedModal').modal('show'); // 显示模态窗口
              },
          });
        })
      });
    </script> -->
  </body>
</html>
